/**
 * Created by hcadmin on 16/4/21.
 */
define([
    "jquery",
    "IO",
    "jqueryUI",
    "bootbox"
], function($,IO,bootbox) {
    $(function () {
        var grid;
        //每列数据列性
        var columns = [
            {
                title: '序号',
                dataIndex: 'index_id',
                dataSource: function (data, datarow, gridobj, current_column) {
                    var index = (gridobj.current_page - 1) * gridobj.page_rows + datarow + 1;
                    return "<span>" + index + "</span>";
                }
            },
            {
                title: '医生姓名',
                dataIndex: 'realname',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].realname + "</span>";
                }
            },
            {
                title: '当前账户余额',
                dataIndex: 'asset',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].reamin_asset + "</span>";
                }
            },
            {
                title: '银行卡号',
                dataIndex: 'card_num',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].card_num + "</span>";
                }
            },
            {
                title: '医生级别',
                dataIndex: 'doctor_type_name',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].doctor_type_name + "</span>";
                }
            },
            {
                title: '应付工资',
                dataIndex: 'reamin_asset',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].reamin_asset + "</span>";
                }
            },
            {
                title: '状态',
                dataIndex: 'status',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].status + "</span>";
                }
            },

        ];


        //数组初始化

        function dataInit() {
            var doctor_name =  $("#doctor_name").val()
            grid = new Grid("/api/settlementLog/list?doctor_name="+doctor_name, $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 10);

            //初始化
            grid.Init();
        }

        //获取输入框内容
        function get_input_param() {

            //var content = $("#citiao_content").val();
            //var param = "content=" + content;
            //return param;
        }

        dataInit();

        //查询
        $("#search").bind("click", function () {
            dataInit();
        });

        $("#export").bind("click",function(){
            var date = new Date();
            console.log("date",date.getDate());
            //if (date.getDate()==2){
                $("#start_account").modal();
            //}
            //dataInit();
        })
        $("#commitExport").bind("click",function(){
            var url = this.value;
            self.location = url;
            setTimeout(function (){self.location = "/96053/salaryaccounting";},500);
        })

    });

})